<template>
	<view class="page">
		<view class="weui-cells page__category-content sc-cells">
			<view class="uni-textarea">
				<textarea v-model="msgContent" @input="onInput" maxlength="500" placeholder="请输入留言内容" focus />
				</view>				
		</view>
		<view class="uni-padding-wrap uni-common-mt">
			<view class="button-sp-area">
				<button type="primary" :disabled="disabled" @click="saveMsg">提交</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				disabled: true,
				orgId: 0,
				msgContent: ""
			}
		},
		onLoad(option) {
			this.orgId = option.orgId;			
		},
		methods: {
			onInput(){
				if(this.msgContent != ""){
					this.disabled = false;
				}else{
					this.disabled = true;
				}
			},
			saveMsg(){
				this.$post(this.$api.orgMsgSave,{orgId: this.orgId, msgContent: this.msgContent}).then(res=>{
					if (res.code == 0) {
						uni.navigateBack();
					} else {
						uni.showModal({
							title: '操作提示',
							content: res.msg,
							showCancel: false
						})
					}
				});
			}
		}
	}
</script>

<style>
	.sc-kongmp-img-wrap {
		display: flex;
		justify-content: center;
	}

	.sc-kongmp-img {
		height: 200upx;
		width: 200upx;
		margin-top: 200upx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50upx;
	}
</style>
